home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / EXIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  400 b   |  17 lines

  1. /* exit.c --- BIBLE pp. 83-84 */
  2. #include <stdio.h>
  3. main()
  4. {
  5.     FILE *fp;
  6.     char filename[40];
  7.     printf("Enter name of file to be opened for writing:");
  8.     gets(filename);
  9.     if((fp = fopen(filename, "w+")) == NULL)
  10.     {
  11.         perror("File open error");
  12.         abort();
  13.     }
  14.     fprint(fp, "If you use \"exit\", this line will appear in the file\n"
  15.                 "because it flushes buffers\n", filename);
  16.     exit(0);
  17. }